﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OrganizedIN.DAL;
using OrganizedIN.BAL;
using OrganizedIN.BussinessServices;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using OrganizedIN.BAL.Common;

namespace OrganizedIN.UI.ToDo
{
    public partial class Add_New_ToDos : System.Web.UI.Page
    {
        DateTime dt = DateTime.Now;
        string UserName;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                UserName = Convert.ToString(Session["UserID"]);
                save_button.Attributes.Add("onClick", "return CheckValidation()");
                lblTodayDate.Text = String.Format("{0:D}", dt);
            }
            catch (Exception ex)
            {
            }
        }
        protected void save_button_Click(object sender, EventArgs e)
        {
            SqlService objservices = new SqlService();
            MyProfileTodo objMyTodo = new MyProfileTodo();
            try
            {
                objMyTodo.ToDoCreateDate = String.Format("{0:dd/MM/yyyy}", dt);
                objMyTodo.TodoSummary = txtSummary.Text;
                objMyTodo.TodoDescription = txtDescription.Text;

                Common.Add_New_Todo(UserName, objMyTodo.ToDoCreateDate, objMyTodo.TodoSummary, objMyTodo.TodoDescription);
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.ToString();
            }                     

            txtSummary.Text = String.Empty;
            txtDescription.Text = String.Empty;
        }
        
       
    }
}
